<template>
  <transition name="fade-transform" mode="out-in">
    <div id="main" />
  </transition>
</template>
<script>
import echarts from 'echarts'
export default {
  data() {
    return {
      chartDom: null,
      myChart: null,
      option: null,
      bk: '#FFF'
    }
  },
  mounted() {
    this.init()
  },
  methods: {
    init() {
      this.myChart = echarts.init(this.$el)
      this.option
      this.option = {
        tooltip: {
          trigger: 'axis'
        },
        backgroundColor: this.bk,
        legend: {
          data: ['邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎'],
          right: 0
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        toolbox: {
          feature: {
            saveAsImage: {}
          }
        },
        xAxis: {
          type: 'category',
          boundaryGap: false,
          data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
        },
        yAxis: {
          type: 'value'
        },
        series: [{
          symbolSize: 20,
          data:
            [120, 132, 101, 134, 90, 230, 210],
          type: 'scatter'
        }]
      }
      this.option && this.myChart.setOption(this.option)
    }
  }
}
</script>

<style lang="scss" scoped>
#main{
  width: 100%;
  height: 100%;
  position: absolute;
}
</style>
